package 顺序表.基础.API;

import java.util.ArrayList;

public class Contains {
    public static void main(String[] args) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        arrayList.add(4);
        //1,返回第一个出现元素的下标
        int x = arrayList.indexOf(3);
        System.out.println(x);
        //2.返回最后一个出现元素的坐标
        int x1 = arrayList.lastIndexOf(3);
        System.out.println(x1);
        //3.查看元素是否存在
        Boolean x2 = arrayList.contains(5);
        System.out.println(x2);
    }
}
